package com.ruge.sms.service.impl;

import com.ruge.sms.dao.ChannelRepository;
import com.ruge.sms.domain.model.Channel;
import com.ruge.sms.domain.request.ChannelRequest;
import com.ruge.sms.service.ChannelService;
import com.ruge.tool.json.JsonTool;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ruge.wu
 * @since 2021/12/14 17:03
 */
@Service
public class ChannelServiceImpl implements ChannelService {
    @Resource
    private ChannelRepository channelRepository;

    /**
     * 新增通道
     *
     * @param request {@link ChannelRequest}
     */
    @Override
    public void save(ChannelRequest request) {
        Channel objToBean = JsonTool.getObjToBean(request, Channel.class);
        channelRepository.save(objToBean);

    }
}
